package com.gipson.amc;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.event.EventListener;

import javax.annotation.PostConstruct;
import java.util.TimeZone;

@SpringBootApplication
@MapperScan("com.gipson.amc.mapper")
@ComponentScan(basePackages = {"com.gipson","com.dsbj"})
public class GipsonAmcApplication {


    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("CTT"));
    }

    public static void main(String[] args) {
        SpringApplication.run(GipsonAmcApplication.class, args);


    }

   @EventListener({ApplicationReadyEvent.class})
    void applicationReadyEvent() {
        System.out.println("应用已经准备就绪 ... 启动浏览器");
        String cmd = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe http://localhost:8900/sys/index";
        Runtime run = Runtime.getRuntime();
        try{
            run.exec(cmd);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
